{extend name='Public:content'/}
{block name='title'}站点配置{/block}
{block name='content'}
<div class="row animated fadeIn">
    <div class="row">
        <div class="col-md-8">
            <div class="panel panel-default tabs">
                <ul class="nav nav-tabs" role="tablist">
                    <li class="active"><a href="#tab-first" role="tab" data-toggle="tab">站点管理
                    </a></li>
                    <li><a href="#tab-second" role="tab" data-toggle="tab">SEO设置</a></li>
                </ul>
                <div class="panel-body tab-content">
                    <div class="tab-pane active" id="tab-first">
                        <form id="add_form1" action="{:url('admin/Setting/save_sites')}" method="post" class="form-horizontal">
                            <div class="panel-body">
                                <div class="row">
                                    <div class="col-md-10">
                                        <div class="form-group">
                                            <label class="col-md-3 control-label">LOGO</label>
                                            <div class="col-md-9">
                                                <div class="gallery">
                                                    <a class="gallery-item"  href="javascript:void('')" title="Space picture 2" data-gallery>
                                                        <div class="image" >
                                                            <input hidden value="{$site_logo}" name="option_value[site_logo]" type="text" id="inp">
                                                            <img src="{:is_img($site_logo)}" alt="Space picture 2"/>
                                                            <ul class="gallery-item-controls">
                                                                <li onclick="upload_single('inp','logo')"><i class="fa fa-cloud-upload"></i></li>
                                                                <li onclick="del_pic('inp')"><i class="fa fa-times"></i></li>
                                                            </ul>
                                                        </div>
                                                    </a>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-md-3 control-label">站点名称</label>
                                            <div class="col-md-9">
                                                <input name="option_value[site_name]" value="{$site_name|default=''}" type="text" class="form-control"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-md-3 control-label">站点地址</label>
                                            <div class="col-md-9">
                                                <input name="option_value[site_addr]" value="{$site_addr|default=''}" type="text" class="form-control"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-md-3 control-label">邮政编码</label>
                                            <div class="col-md-9">
                                                <input name="option_value[site_admin_email]" value="{$site_admin_email|default=''}" type="text" class="form-control"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-md-3 control-label">电话联系方式</label>
                                            <div class="col-md-9">
                                                <input name="option_value[tel]" value="{$tel|default=''}" type="text" class="form-control"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-md-3 control-label">ICP备案号</label>
                                            <div class="col-md-9">
                                                <input name="option_value[icp]" value="{$icp|default=''}" type="text" class="form-control"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-md-3 control-label">版权信息</label>
                                            <div class="col-md-9">
                                                <textarea name="option_value[site_copyright]" class="form-control" rows="5">{$site_copyright|default=''}</textarea>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-md-3  control-label">网站开启状态(默认开启)</label>
                                            <div class="col-md-9">
                                                <label class="switch">
                                                    <input name="is_close" {:is_checked($is_close)} type="checkbox" value="1"/>
                                                    <span></span>
                                                </label>
                                                <span class="help-block">默认正常</span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="panel-footer">
                                <button class="btn btn-info pull-right">保存修改<span class="fa fa-floppy-o fa-right"></span></button>
                            </div>
                        </form>
                    </div>
                    <div class="tab-pane" id="tab-second">
                        <form id="add_form2" action="{:url('admin/Setting/save_seo')}" method="post" class="form-horizontal">
                            <div class="panel-body">
                            <div class="row">
                                <div class="col-md-10">
                                    <div class="form-group">
                                        <label class="col-md-3 control-label">SEO标题</label>
                                        <div class="col-md-9">
                                            <input type="text" value="{$seo_title|default=''}" name="option_value[seo_title]" class="form-control"/>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-md-3 control-label">SEO关键字</label>
                                        <div class="col-md-9">
                                            <input name="option_value[seo_key]"
                                                   placeholder="添加关键词,以便被快速找到" value="{$seo_key|default=''}"
                                                   class="tagsinput" />
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-md-3 control-label">SEO描述</label>
                                        <div class="col-md-9">
                                            <textarea name="option_value[seo_remark]" class="form-control" rows="5">{$seo_remark|default=''}</textarea>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            </div>
                            <div class="panel-footer">
                                <button class="btn btn-info pull-right">保存修改<span class="fa fa-floppy-o fa-right"></span></button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    $('#add_form1').ajaxForm({
        beforeSubmit: showRequest,
        success: showResponse
    });
    $('#add_form2').ajaxForm({
        beforeSubmit: showRequest,
        success: showResponse
    });

    function showRequest() {
        m_loading('数据上传中,请稍等^_^',{
            time:-1
        });
    }

    function showResponse(res) {
        destory();
        if(res.code) {
            m_success(res.msg);
        }else{
            m_error(res.msg);
        }
    }
</script>
{/block}